var numWaterBottles = function (numBottles, numExchange) {
    let result = numBottles
    let empty = numBottles
    while (empty >= numExchange) {
        let change = Math.floor(empty / numExchange)
        result += change
        empty = (empty % numExchange) + change
    }
    return result
}